package com.tedu.egmybatis1.pojo;

import com.tedu.egmybatis1.mapper.Product;
import org.apache.ibatis.annotations.*;


import java.util.ArrayList;


@Mapper
public interface ProductMapper {
    @Insert("INSERT INTO product(title,price,stock) VALUES(#{title},#{price},#{stock})")
    int insert(Product product);
    @Select("SELECT * FROM product WHERE id=#{id}")
    Product selectSingleProduct(int id);
    @Delete("DELETE  FROM product WHERE id=#{id} ")
    int deleteById(int id);
    @Select(("SELECT * FROM product"))
    ArrayList<Product> selectManyProduct();
    @Select(("SELECT * FROM product"))
    Product[] selectManyProducts();
    @Update("UPDATE product SET title=#{title},price=#{price},stock=#{stock} WHERE id=#{id}")
    int updateByid(Product product);

}
